package com.android.download.activity

import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import com.android.download.entity.AppInfo

class MainViewModel : ViewModel() {

    val appListData: MutableLiveData<MutableList<AppInfo>> by lazy {
        MutableLiveData<MutableList<AppInfo>>()
    }

    fun requestAppListData() {
        val appList: MutableList<AppInfo> = mutableListOf()
        var appInfo = AppInfo(
            "QQ",
            "https://pp.myapp.com/ma_icon/0/icon_6633_1584375640/96",
            "https://imtt.dd.qq.com/16891/apk/C10B2237586138DF3909E47B981B73F9.apk"
        )
        appList.add(appInfo)

        appInfo = AppInfo(
            "微信",
            "https://pp.myapp.com/ma_icon/0/icon_10910_1583380721/96",
            "https://dldir1.qq.com/weixin/android/weixin8016android2040.apk"
        )
        appList.add(appInfo)

        appInfo = AppInfo(
            "京东",
            "https://pp.myapp.com/ma_icon/0/icon_7193_1584605936/96",
            "https://storage.360buyimg.com/jdmobile/JDMALL-PC2.apk"
        )
        appList.add(appInfo)
        appListData.value = appList
    }
}